<?php 
/**
 * SelectListModel
 * Provide static function for get list of values from database
 * @version 1.0
 * @date 23/05/2011
 */

class SelectListModel{
	
	public static function getListSeatNumberList($default = false){
		if($default)
			$arr[0] = "全部";
		$arr[4] = 4;
		$arr[6] = 6;
		$arr[10] = 10;

		return $arr;
	}
	
	public static function getListRoomType($default = false){
		if($default)
			$arr[0] = "全部";
		$arr[ROOM_TYPE_MEETING_ROOM] = "会議室";
		$arr[ROOM_TYPE_BOOTH] = "会議ブース";

		return $arr;		
	}
	
	public static function getListUserStatus($default = false){
		if($default)
			$arr[0] = "全部";
		$arr[STATUS_NORMAL] = "アクティブ";
		$arr[STATUS_WAITING] = "承認待ち";

		return $arr;		
	}
	
	public static function getListRoom($seat_number = null,$default = false, $view_deleted = false){
		Zend_Loader::loadClass('RoomModel');
		
		$arr = array();
		if($default)
			$arr[0] = "全部";
		$model = new RoomModel();
		$list = $model->getListRoom("all", "", $seat_number);
		$list = $model->getListRoom("all", "", $seat_number, 0, NULL, NULL, $view_deleted);
		
		foreach ($list as $row){
			$arr[$row['id']] = $row['code'];
		}
		
		return $arr;
	}
	
	public static function getListOrderStatus(){
		$arr[-1] = "全部";
		$arr[STATUS_NORMAL] = "登録した";
		$arr[STATUS_CANCELED] = "キャンセルされた";
		$arr[STATUS_PENALTY] = "ペナルティ";
		
		return $arr;
	}
	
	public static function getListUser($default = false){
		Zend_Loader::loadClass('UserModel');
		
		$arr = array();
		if($default)
			$arr[0] = "全部";
		$model = new UserModel();
		$list = $model->getListUser("all", "", NULL, NULL, STATUS_NORMAL, NORMAL_USER);
		
		foreach ($list as $row){
			$arr[$row['id']] = $row['username'] . " (" . $row['name']. ")";
		}
		
		return $arr;
	}
	
}